//
//  RaeRequestApi.swift
//  77Club
//
//  Created by Apple on 2024/8/26.
//

import Foundation
import Alamofire

enum RaeRequestApi {

    case register(user_name: String, passwd: String)
    case login(user_name: String, passwd: String)
    case delete
    case logout
    case loginLog
}

extension RaeRequestApi {
    
    /// 请求路径
    /// Request Path
    var path: String {
        switch self {
        case .register:                       return "system/app/user/register"
        case .login:                          return "system/app/user/login"
        case .delete:                         return "system/app/user/deleteSelf"
        case .logout:                         return "system/app/user/logout"
        case .loginLog:                       return "ruoyi/app/requestLog/put"
        }
    }
    
    /// 参数拼接
    /// Splicing Parameters
    var parameters: [String : Any] {
        var para:[String : Any] = [String : Any]()
        switch self {
        case .register(let user_name, let passwd):
            para["username"] = user_name
            para["password"] = passwd
            para["userType"] = userType
        case .login(let user_name, let passwd):
            para["username"] = user_name
            para["password"] = passwd
            para["userType"] = userType
            
        default: return para
        }
        return para
    }
    
}
